# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=c-ares
pkgver=1.24.0
pkgrel=0
pkgdesc="Asynchronous DNS/names resolver library"
url="https://c-ares.org/"
arch="all"
license="MIT"
makedepends="gtest-dev"
subpackages="$pkgname-doc $pkgname-static $pkgname-dev $pkgname-utils::noarch"
source="https://c-ares.haxx.se/download/c-ares-$pkgver.tar.gz
	fix-tests-symbol-hiding.patch
	"

# secfixes:
#   1.17.2-r0:
#     - CVE-2021-3672

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-shared
	make
}

check() {
	test/arestest --gtest_filter=-*.Live*
}

package() {
	make DESTDIR="$pkgdir" install
	cd src/tools
	install -Dm755 -t "$pkgdir"/usr/bin \
		adig ahost
}

utils() {
	amove usr/bin
}

sha512sums="
3701853e263de94daf19734185ad913848c19b825e0738926b418a54b0628ee1ac95a49ebfaa2ddf3eed74a7ef209e1a0a8f573df3e507ef1f11fcc53fc5eb68  c-ares-1.24.0.tar.gz
136b4e7a1988709e2ec96638e0ca546b1a3100cd0047d9ffb35344b7e1a4486fc7e0df2faee1096d51bf2056701d0e21b6786ea2662fca1de4f264b29939949c  fix-tests-symbol-hiding.patch
"
